import request from "@/utils/request";

function getUserListRes(page,limit,username){
    return request.get("/admin/acl/user/"+`${page}/${limit}`,{params:{username}})
}

// 添加用户或者修改
function addUserRes(data){
    if(data.id){
        return request.put("/admin/acl/user/update",data)
    }else{
        return request.post("/admin/acl/user/save",data)
    }
    
}
// 查看用户的角色信息
function getUserRoleRes(id){
    return request.get("/admin/acl/user/toAssign/"+id)
}
// 给用户分配角色
function setUserRoleRes(userId,roleId){
    return request.post("/admin/acl/user/doAssign?userId="+`${userId}&roleId=${roleId}`)
}
// 删除单个用户
function deleteUserRes(id){
    return request.delete("/admin/acl/user/remove/"+id)
}
//删除多个
function deleteUserListRes(idList){
    
    return request.delete("/admin/acl/user/batchRemove",idList)
}

export default {
    getUserListRes,
    addUserRes,
    getUserRoleRes,
    setUserRoleRes,
    deleteUserRes,
    deleteUserListRes
}